#!/bin/sh
#
# Author ： hbaolong@vip.qq.com
#
# Function : 列出所读书中使用最多的单词
#
#
#

if [ $# -ne 0 ]; then
	echo "Usage: this is a empty shell."
	exit
fi

workdir="/Users/hbaolong/workshop/gitee/3place/dicts"

TMPFILE=`echo $0|awk -F/ '{print $NF}'``date|sed -e "s/ //g"`.tmp

cd $workdir

cat *.md  |sort |uniq -c|sort -g  |sed -e "s/^ *//g" >/tmp/$TMPFILE

vipnum=`tail -1 /tmp/$TMPFILE | awk '{print $1}'`

num_of_dicts=`ls $workdir |wc |awk '{print $1}'`

num_of_vip=`grep "^"$vipnum /tmp/$TMPFILE |awk '{print $2 "\t"}' |wc |awk '{print $1}'`

echo $num_of_vip "words with VIPNUM "$vipnum" in "$num_of_dicts" dicts"

echo ""

grep "^"$vipnum /tmp/$TMPFILE |awk '{printf $2 "\t"}'

echo ""

echo ""

rm -f /tmp/$TMPFILE
